package com.zqh.elasticsearch.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-13 17:58
 */
@Configuration
public class ElasticsearchConfigration{

    @Value("${elasticsearch.addr.host}")
    private String host;

    @Bean
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(RestClient.builder(HttpHost.create(host)));
    }
}
